#@head() #@header()
<title>融资需求管理</title>
#@aside("custser")
<script type="text/javascript" src="#(path)/assets/js/jquery.tmpl.min.js"></script>
<div class="content-wrapper">
	<section class="content">
		<div class="nav-tabs-custom">
		#@custsermenu("extract")
           
            <div class="tab-content">
              <div class="tab-pane active" id="tab_1">
				<label style="float:left;margin-top:17px;margin-left:20px;">时间区间:</label>
				<input type="text" id="startime" class="form-control" onClick="WdatePicker()" style="width:120px;float:left;margin-top:10px;margin-left:10px;">
				<span style="float:left;margin:15px 5px 0 5px;">—</span>
				<input type="text" id="endtime" class="form-control" onClick="WdatePicker()" style="width:120px;float:left;margin-top:10px;margin-right:20px;">
				<div class="input-group margin" style="width:400px;float:left">
					<input id="bidname" type="text" class="form-control"  >
					<span class="input-group-btn">
					  <button id="bidseach" type="button" class="btn btn-info btn-flat">搜索</button>
					</span>
				</div>
				<div class="box-body">
					<table id="example1" class="table table-striped">
						<thead>
							<tr>
								<th>客户姓名</th>
								<th>客户号码</th>
								<th>交易流水号</th>
								<th>提现金额</th>
								<th>提现时间</th>
								<th>所属客服</th>
								<th>状态</th>	
								<th>备注</th>
							</tr>
						</thead>
						<tbody id="shenheall">

						</tbody>
					</table>
				</div>
				<div class="box-footer clearfix">
				  <ul class="pagination pagination-sm no-margin pull-right">
					<li id = "shall1"><a href="#">首页</a></li>
					<li id = "shall2"><a href="#">上一页</a></li>
					<li><a href="#">第<span id="shall5"></span>页 共<span id="shall6"></span>页</a></li>
					<li id = "shall3"><a href="#">下一页</a></li>
					<li id = "shall4"><a href="#">尾页</a></li>
				  </ul>
				</div>
              </div>
            <!-- /.tab-content -->
          </div>
	</section>
</div>
#@footer()
 <script id="shenhejieguo" type="text/x-jquery-tmpl">
	<tr>
		
		<td>${name}</td>
		<td>${mobile}</td>
		<td>${code}</td>
		<td>${amount}元</td>
		<td>${create_time}</td>
		<td>${agent}</td>
		<td><span class="badge ${cla}">${status}</span></td>
		<td>${summary}</td>
	</tr>
</script>
<script>
function shall(page,startime,endtime,bidname){
	$.getJSON("/merit/withdraw?token=#(session.token??)&page="+page+"&size=14&status=repaying&repayTimeStart="+startime+"&repayTimeEnd="+endtime+"&bidName="+bidname, function(shlist) {
		
		totalPage = shlist.data.page.totalPage;
		$("#shall6").html(totalPage);
		$.each(shlist.data.page.list, function(i, item){ 
			var aa=item.status;
			var cla="";
			if(aa=="success"){
			var status = "提现成功";
			cla="bg-green";
			}else{cla="bg-red";var status = "提现失败";}
			var amounts = (item.amount + item.interest).toFixed(2);
			
			var jieguolist = {cla:cla,status:status,agent:item.agent,code:item.code,bid_name:item.bid_name,name:item.name,mobile:item.mobile,amount:item.amount,create_time:item.create_time,summary:item.summary,cla:cla};
			$("#shenhejieguo").tmpl(jieguolist).appendTo('#shenheall');
		});
	});
}
var startime = "";
var endtime ="";
var bidname = "";
 $(document).ready(function(){ 
	$("#shenheall").empty();
	shall(1,startime,endtime,bidname);
	pageNumber = 1;
	totalPage = 1;
	$("#shall5").html(pageNumber);
});
$("#shall1").click(function(){
	$("#shenheall").empty();
	shall(1,startime,endtime,bidname);
	pageNumber = 1;
	$("#shall5").html(pageNumber);
});
$("#shall2").click(function(){
	if(pageNumber==1){
		alert("当前页是首页!");
	}else{
	$("#shenheall").empty();
	pageNumber = pageNumber-1;
	shall(pageNumber,startime,endtime,bidname);
	$("#shall5").html(pageNumber);
	}
});
$("#shall3").click(function(){
	if(pageNumber==totalPage){
		alert("当前页是尾页!");
	}else{
	$("#shenheall").empty();
	pageNumber = pageNumber +1;
	shall(pageNumber,startime,endtime,bidname);
	$("#shall5").html(pageNumber);
	}
});
$("#shall4").click(function(){
	$("#shenheall").empty();
	shall(totalPage,startime,endtime,bidname);
	pageNumber = totalPage;
	$("#shall5").html(pageNumber);
});
$("#bidseach").click(function(){
	$("#shenheall").empty();
	startime = $("#startime").val()+" 00:00:00";
	
	endtime = $("#endtime").val()+" 24:00:00";
	
	bidname = $("#bidname").val();
	
	shall(1,startime,endtime,bidname);
	pageNumber = 1;
	$("#shall5").html(pageNumber);
});
</script> 

</body>
</html>
